#Tests distributions beta
library(actuar)

densNoyauBeta<-c(1,999)

#70%-30%
X<-0.3*rlnorm(200,meanlog=0,sdlog=0.5)+0.7*rpareto(200,shape=1.5,scale=1)
b<-sd(X)*200^(-0.5)

#Transformation Y=H(X)
est<-nlm(LChamp,c(1,1),X=X)
Y<-pchampernowne(X,est$estimate[1],median(X),est$estimate[2])

#plot(density(Y,bw=b))


for(j in 1:999)
{
x<-j/1000
densNoyauBeta[j]<-1/200*sum(dbeta(Y,(x/b)+1,((1-x)/b)+1))
}

x<-seq(0.001,0.999,0.001)
plot(x,densNoyauBeta,ylim=c(0,1.3),type="l",lwd=2,col="dark magenta")
abline(h=1,lty=3,lwd=2,col="dark gray")



